@extends('admin.layout.admin_main')

@section('content')
    <include file="Public/common/content-header" pagename="权限管理"/>
    <section class="content ">
        <include file="Public/common/message"/>
        <div class="row">
            @include('admin.auth.common.sys_menu',['name' => 'role'])
            <div class="col-md-10">
                <div class="box box-primary">
                    @include('admin.common.go_history',['title' => '编辑角色'])
                    <form id="info_form" class="form-horizontal">
                        {{ csrf_field() }}
                        <div class="box-body">
                            <div class="form-group">
                                <label for="name" class="col-sm-2 control-label">角色标签</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                        <input type="text" id="name" name="name" value="{{$role->name}}"
                                               class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="name" class="col-sm-2 control-label">角色名</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                        <input type="text" id="display_name" name="display_name" value="{{$role->display_name}}"
                                               class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="password" class="col-sm-2 control-label">描述</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                        <input type="text" id="description" name="description" value="{{$role->description}}"
                                               class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="box-footer">
                            <div class="col-sm-2"></div>
                            <div class="col-sm-8">
                                <div class="btn-group pull-left">
                                    <button type="reset" class="btn btn-info btn-sm">重置
                                    </button>
                                </div>
                                <div class="btn-group pull-right">
                                    <input type="hidden" name="id" value="{{$role->id}}">
                                    <input class="btn btn-primary btn-sm" type="button" onclick="save()" value="保存">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <script>
        function save() {
            nform.submit('info_form', '{{route('admin-role-save')}}', function () {
                goUrl('{{route('admin-roles')}}')
            });
        }
    </script>
@endsection
